package com.mvvm.start.base.network

/**
 * @author lmy
 * @功能: 返回结果统一处理的Response类
 * @Creat 2020/11/6 3:56 PM
 * @Compony 465008238@qq.com
 */
class DataResponse<T> {
    var code = "200"
    var flag: Boolean = false
    var msg: String? = null
    var data: T? = null
        private set

    fun setData(data: T) {
        this.data = data
    }

    val errorMsg: String
        get() = msg.takeIf { it.isNullOrBlank().not() } ?: "网络错误"
    val isSuccess: Boolean
        get() = flag
}
/**
 * 200: 成功
 */